package com.laicunba.ext.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.laicunba.ext.pojo.Page;
import com.laicunba.ext.service.SlaveFinancingTargetBidService;
import com.laicunba.pojo.vo.FinancingTargetBidVO;

@SuppressWarnings({ "unchecked", "rawtypes" })
@Service
public class SlaveFinancingTargetBidServiceImpl extends BaseService implements SlaveFinancingTargetBidService {

	@Override
	public int countFinancingTargetBidByTargetId(String financingTargetId) {
		return slaveGenericQueryDao.selectOne("SLAVE_FINANCING_TARGET_BID.countFinancingTargetBidByTargetId", financingTargetId);
	}

	@Override
	public List<FinancingTargetBidVO> findFinancingTargetBidByTargetId(String financingTargetId, Page page) {
		Map map = new HashMap();
		map.put("financingTargetId", financingTargetId);
		if(page != null && page.getPageIndex() > 0) {
			map.put("limit", page.getPageSize());
			map.put("offset", (page.getPageIndex() - 1) * page.getPageSize());
		}
		return slaveGenericQueryDao.selectList("SLAVE_FINANCING_TARGET_BID.findFinancingTargetBidByTargetId", map);
	}
	
}
